package com.dolawing.phonecallapp.keepAliveUi;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

/**
 * Created by Amn on 2019/4/20.
 */

public class KeepReceive extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {

        String action= intent.getAction();
        //开屏
        if(TextUtils.equals(action,intent.ACTION_SCREEN_ON)){
            KeepManager.getInstance().startKeep(context);

        }else if(TextUtils.equals(action,intent.ACTION_SCREEN_OFF)){
            //息屏
            KeepManager.getInstance().finishKeep();
        }
    }
}